import mongoose from "mongoose";
import { encrypt } from "../utils/bcryptjs";
const userRuler = new mongoose.Schema({
  email: { type: String, require: true, unique: true },
  nickname: { type: String },
  avator: { type: String, default: "/upload/bb11be7cec69344e80cde3201.jpg" },
  password: {
    type: String,
    require: true,
    set(val: string) {
      return encrypt(val);
    },
  },
});
const userModel = mongoose.model("userinfo", userRuler);
export { userModel };
